import { h } from 'vue';
import { NAvatar, NLayout } from 'naive-ui';
import { BasicColumn } from '@/components/Table';
import Code from '@/components/Code/Code.vue';
import { divide } from 'lodash';
import { ClickOutside } from 'element-plus';
import { formattedDate } from '@/config/options';
export interface ListData {
  encode: string;
  unit_id: string;
  workshop_id: string;
  produce_time: string;
  site: string;
  repair_time: string;
  scrap_time: string;
  user: string;
  condition: string;
  code_path: string;
  scan_num: string;
}

export const columns: BasicColumn<ListData>[] = [
  {
    title: '编码',
    key: 'encode',
    width: 90,
  },
  {
    title: '单位名称',
    key: 'unit_name',
    width: 90,
  },
  {
    title: '车间名称',
    key: 'workshop_id',
    width: 90,
  },

  {
    title: '产品名称',
    key: 'id',
    width: 90,
  },
  {
    title: '放置点',
    key: 'site',
    width: 90,
  },
  {
    title: '生产日期',
    key: 'produce_time',
    width: 130,
  },
  {
    title: '维修日期',
    key: 'repair_time',
    width: 130,
  },
  {
    title: '报废日期',
    key: 'scrap_time',
    width: 130,
  },
  {
    title: '添加人',
    key: 'user',
    width: 90,
  },
  {
    title: '添加日期',
    key: 'createtime',
    width: 170,
    render(row) {
      return h(NLayout, formattedDate(row.createtime * 1000));
    },
  },
  {
    title: '状态',
    key: 'status_text',
    width: 90,
  },
  {
    title: '二维码',
    key: 'code_path',
    width: 100,
    render(row) {
      return h(Code, { row });
    },
  },

  {
    title: '扫码次数',
    key: 'scan_num',
    width: 90,
  },
];
